<?php

namespace app\data\controller\shop;

use app\data\service\GoodsService;
use think\admin\Controller;

/**
 * 投资到期情况报表
 * Class Portal
 * @package app\data\controller\total
 */
class Expire extends Controller
{
    /**
     * 投资到期情况报表
     * @auth true
     * @menu true
     */
    public function index()
    {
        $month = getPurMonth(date('Y-m-d'),1);
        $monthStart = date('Y-m-01', strtotime($month));
        $monthEnd = date('Y-m-t', strtotime($month));

        $where = [];
        $where[] = ['end_at', '>=', $monthStart];
        $where[] = ['end_at', '<=', $monthEnd];

        //下月按月返应返利息
        $this->goodsAyfLxjeTotal   = $this->app->db->name('ShopOrder')->where($where)->where('goods_return_rule', '=', 1)->sum('expire_month_lxje');
        //下月到期返应返利息
        $this->goodsDqfLxjeTotal   = $this->app->db->name('ShopOrder')->where($where)->where('goods_return_rule', '=', 2)->sum('expect_lxje');
        $this->goodsOrderTotal  = $this->app->db->name('ShopOrder')->where($where)->count();
        $this->goodsAmountTotal = $this->app->db->name('ShopOrder')->where($where)->sum('money');

        $this->_query('ShopOrder')->where($where)->order('create_at desc,id desc')->page();

    }

    public function _index_page_filter(&$data){



    }

}